<template>
  <div id="pixBox" @mouseenter="isShow(true)" @mouseleave="isShow(false)">
    <img :src="imgUrl"/>
    <div id="content" ref="content">
      {{content}}
    </div>
  </div>
</template>

<script>
export default {
  name: 'PicBox',
  props: {
    imgUrl: String,
    content: String
  },
  methods: {
    isShow (bool) {
      if (bool) {
        this.$refs.content.style.display = 'block'
      } else {
        this.$refs.content.style.display = 'none'
      }
    }
  }
}
</script>

<style scoped>
  #pixBox{
    width: 50%;
    height: 30rem;
    float: left;
    background-color: #666666;
    text-align: center;
    position: relative;
  }
  #pixBox img{
    width: 90%;
    height: 90%;
    border: 0.2rem solid #000000;
    margin-top: 5%;
  }
  #content{
    width: 90%;
    height: 25%;
    background-color: rgba(0,0,0,0.6);
    position: absolute;
    left: 5%;
    bottom: 4%;
    color: aliceblue;
    font-size: 8px;
    padding: 1rem;
    display: none;
  }
</style>
